<script setup lang="ts">
import { showSuccessToast, showFailToast } from 'vant';
import { useUserStore } from '@/stores/user'
import { useRouter } from 'vue-router';
const router = useRouter()
const useStore = useUserStore()

// 导航栏返回事件
function onClickLeft() {
    router.push('/my')
}

function loginOut() {
    window.localStorage.clear()
    // useStore.setUserState(false)
    useStore.userState=false
    router.push('/login')
}
</script>

<template>
    <van-nav-bar title="设置" left-text="返回" left-arrow @click-left="onClickLeft" />
    <div class="boxset">
        <!-- 导航栏 -->

        <section>
            <van-cell-group inset>
                <van-cell title="地址管理" is-link @click="router.push('/setup/address')"/>
                <van-cell title="功能介绍" is-link @click="router.push('/setup/introduction')"/>
                <van-cell title="清除本地缓存" is-link @click="showSuccessToast('已清除')"/>          
            </van-cell-group>

            <van-cell-group inset>    
                <van-cell title="法律声明" is-link @click="router.push('/setup/law')"/>
                <van-cell title="用户服务协议" is-link @click="router.push('/setup/userservices')"/>
                <van-cell title="隐私" is-link @click="router.push('/setup/privacy')"/>
            </van-cell-group>

            <van-cell-group inset>
                <van-cell title="检查更新" is-link @click="showSuccessToast('当前已为最新版本')"/>
            </van-cell-group>

            <van-button type="primary" size="large" @click="loginOut">退出登录</van-button>
        </section>
    </div>
</template>

<style lang="scss" scoped>

.van-nav-bar {
  background-color: #f7fdff;
}
.van-cell-group {
    margin-top: 30px;
}

.van-button {
    border-radius: 25px;
    width: 350px;
    margin-top: 30px;
    margin-left: 0.15rem;
}

.boxset{
    display: flex;
    flex-direction: column;

    section{
        flex: 1;
        overflow: auto;
    }
}
</style>